package com.zzjson.design.proxy.my.jdk;

import sun.misc.ProxyGenerator;

import java.io.FileOutputStream;
import java.io.IOException;

/**
 * <p>****************************************************************************</p>
 * <p><b>Copyright © 2010-2018 rollBall team All Rights Reserved<b></p>
 * <ul style="margin:15px;">
 * <li>Description : cn.zzjson.design.proxy.my</li>
 * <li>Version     : 1.0.0</li>
 * <li>Creation    : 2018年12月01日</li>
 * <li>@author     : zzy0_0</li>
 * </ul>
 * <p>****************************************************************************</p>
 */
public class MeiPoTest {
    public static void main(String[] args) throws IOException {
        MeiPo meiPo = new MeiPo();
        Person person = (Person) meiPo.getInstance(new PangHu());
        person.findLove();
        byte[] data = ProxyGenerator.generateProxyClass("$Proxy1", new Class[]{person.getClass()});
        FileOutputStream fileOutputStream = null;
        try {
            fileOutputStream = new FileOutputStream("$Proxy1.java");
            fileOutputStream.write(data);
            fileOutputStream.flush();
        } finally {
            fileOutputStream.close();

        }


    }

}